<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>SSE 推送消息</title>
</head>
<body>
<div id="msgFrompPush">
</div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
    var s='';
    // 立即执行
    (function deferred() {
        $.get('defer', function (data) {
            s+=data+"<br/>";
            $("#msgFrompPush").html(s);
            deferred();
        });
    })();
</script>
</body>
</html>
